<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="../include/js/jq.js"></script>
        <script type="text/javascript" src="swfupload/swfupload/swfupload.js"></script>
        <script type="text/javascript" src="swfupload/js/swfupload.queue.js"></script>
        <script type="text/javascript" src="swfupload/js/fileprogress.js"></script>
        <script type="text/javascript" src="swfupload/js/handlers.js"></script>
        <link href="swfupload/default.css" rel="stylesheet" type="text/css" />
        <!--初始化CKEDITOR-->
        <script src="<{$config.SITE_URL}>/include/ckeditor/ckeditor.js"></script>              
        <script>
            $(function(){
                
                CKEDITOR.replace('info');
            
            })
        </script>
        <!--初始化swfupload-->
        <script type="text/javascript">
            var swfu;
            $(function(){
                var settings = {
				flash_url : "swfupload/swfupload/swfupload.swf",
				upload_url: "upload.php",
				post_params: {"PHPSESSID" : "<{$G.sessionid}>"},
				file_size_limit : "100 MB",
				file_types : "*.*",
				file_types_description : "All Files",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				// Button settings
				button_image_url: "swfupload/images/TestImageNoText_65x29.png",
				button_width: "65",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span class="theFont">浏览</span>',
				button_text_style: ".theFont { font-size: 16; }",
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
            })
        </script>
        <script>
            function getpics(){
                $("#pics").load('<{$config.SITE_URL}>/admin/getpics.php?commoid=<{$commoinfo.id}>&r='+Math.random());
            }
            function delpic(aid){
                if(!aid){
                    alert('未指定图片id');
                    return false;
                }
                $.get("<{$config.SITE_URL}>/admin/tools.php?action=delpic&aid="+aid,function(data){
                    alert(data);
                });
                
                getpics();
            }
            $(function(){
                getpics();
            })
            $(function(){
                $("#upon").click(function(){
                    $(".zhegai,#fileupload").css("display","block");
                })
            })
            function upoff(){
                $(".zhegai,#fileupload").css("display","none");
                getpics();
            }
            function copypic(txt){                                               
                        $(".picurl > textarea").html(txt);
                        $(".picurl").css("display","block");
                        
            }
        </script>
        
        <link rel="stylesheet" href="<{$config.SITE_URL}>/images/admin/style.css"/>       
        <style>
            .main{
                z-index: -1;
                position: absolute;
                top:0;
                left: 0;
            }
            table{
                border:0;
                padding:0;
                margin:0;
            }
            table tr td{
                border-bottom: 1px #eeeeee solid;
                height:20px;
                line-height:20px;
                overflow:hidden;
            }
            
            #fileupload{
                position: absolute;
                top:0;
                left:0;
                padding-top: 100px;
                width: 100%;
                height:700px;
                z-index: 100;
                
                display: none;
                
            }
            .zhegai{
                position: absolute;
                top:0;
                left:0;
                width: 100%;
                min-height:900px;
                background:#eeeeee ;
                opacity:0.80;
                filter: alpha(opacity = 80);
                zoom:1;
                z-index: 1;
                display: none;
            }
            .commoform{
                width:600px;
                margin:auto;
                overflow:hidden;
            }
            .picurl{
                
                z-index:101;
                width:600px;
                height:30px;
                background-color: #53D9F0;
                overflow: hidden;
                position:absolute;
                margin:300px 0 0 60px;
                display: none;
            }
        </style>
    </head>
    <body>
        
        <div class="main">
            <div class="commoform">
                <form method="post">
                    <input type="hidden" name="commoid" value="<{$commoinfo.id}>" />
                    <table>
                        <tr><td>商品名称</td><td><input type="text" name="name" value="<{$commoinfo.name}>"/></td></tr>
                        <tr><td>seo标题</td><td><input type="text" name="seoname" value="<{$commoinfo.seoname}>"/></td></tr>
                        <tr><td>分类</td><td><select name="typeid"><option value="0">--请选择分类--</option><{section name=op loop=$options}><{if $options[op].id==$commoinfo.typeid}><option value="<{$options[op].id}>" selected="selected"><{$options[op].n}><{$options[op].name}></option><{else}><option value="<{$options[op].id}>"><{$options[op].n}><{$options[op].name}></option><{/if}><{/section}></select></td></tr>
                        <tr><td>市场价</td><td><input type="text" name="price" value="<{$commoinfo.price}>"/></td></tr>
                        <tr><td>本店价</td><td><input type="text" name="vprice" value="<{$commoinfo.vprice}>"/></td></tr>
                        <tr><td>打折促销</td><td><input type="text" name="discount" value="<{$commoinfo.discount}>"/> 0为不促销，1~9折</td></tr>
                        <tr><td>库存</td><td><input type="text" name="stock"  value ="<{$commoinfo.stock}>"/></td></tr>
                        <tr><td>已售出</td><td><input type="text" name="sell"  value ="<{$commoinfo.sell}>"/></td></tr>
                        <tr><td colspan="2">图库:</td></tr>
                        <tr><td colspan="2" id="pics"></td></tr>
                        <tr><td colspan="2"><input type="button" value="上传图片" id="upon"/></td></tr>
                        <tr><td>商品简介</td><td><textarea name="info" id="info" cols="100" rows="5"><{$commoinfo.info}></textarea></td></tr>
                        <tr><td></td><td><input type="submit" name="submit" value="提交"/></td></tr>
                    </table>
                    
                    
                </form>
            </div>            
        </div>
        <div id="fileupload">
            <div style="width:450px;min-height: 100px;margin-left: 100px;background:#316ac5; padding: 20px;">
                <h2>文件上传</h2>
                <form id="form1" method="post" enctype="multipart/form-data">                        
                                <div class="fieldset flash" id="fsUploadProgress">
                                    <span class="legend">上传进度</span>
                                </div>
                        <div id="divStatus">0 个文件已上传</div>
                                <div>
                                        <span id="spanButtonPlaceHolder"></span>
                                        
                                        <input id="btnCancel" type="button" value="取消上传" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
                                        <input type="button" value="完成" onclick="upoff()"/>
                                </div>
                        

                </form>
            </div>
         </div>
        <div class="zhegai"></div>
        <div class="picurl"><textarea style="width:400px;height:28px;line-height: 28px;margin-left: 1px;float:left;padding:0 0 0 15px;"></textarea><a href="javascript:$('.picurl').css('display','none')" style="width: 30px;line-height: 30px;float: right;display: block;">关闭窗口</a></div>
    </body>
</html>
